#include "stdafx.h"
#include "strategy.h"
#include "jugadores.h"

#include "Log.h"

#define SIN_PREDICCION

void PredictBall ( Environment *env )
{
	double dx = env->currentBall.pos.x - env->lastBall.pos.x;
	double dy = env->currentBall.pos.y - env->lastBall.pos.y;
	env->predictedBall.pos.x = env->currentBall.pos.x + dx;
	env->predictedBall.pos.y = env->currentBall.pos.y + dy;
}

void PredictBall ( Environment *env, double correccion_x, double correccion_y )
{
    #ifndef SIN_PREDICCION
	double dx = env->currentBall.pos.x - env->lastBall.pos.x;
	double dy = env->currentBall.pos.y - env->lastBall.pos.y;

	//Log("ball", "ball", env->lastBall.pos.x, env->lastBall.pos.y, env->currentBall.pos.x, env->currentBall.pos.y);

    env->predictedBall.pos.x = env->currentBall.pos.x + dx + correccion_x;
    env->predictedBall.pos.y = env->currentBall.pos.y + dy + correccion_y;
    #else
	env->predictedBall.pos.x = env->currentBall.pos.x + correccion_x;
	env->predictedBall.pos.y = env->currentBall.pos.y + correccion_y;
	#endif
}
